package com.grape.dp.handler.handler;


import com.grape.dp.handler.handler.impl.BlacklistHandler;
import com.grape.dp.handler.handler.impl.ConversationHandler;
import com.grape.dp.handler.handler.impl.CurrentLimitHandler;

/**
 * 描述:FactoryHandler
 * @author: myx
 * @date: 2019/7/22 0022
 * Copyright © 2019-grape. All rights reserved.
 */
public class FactoryHandler {
    /**
     * 获取链表第一个
     * @return
     */
    public static GatewayHandler getGatewayHandler() {
        // 1.使用工厂模式封装Handler责任链
        GatewayHandler gatewayHandler1 = new CurrentLimitHandler();
        GatewayHandler gatewayHandler2 = new BlacklistHandler();
        gatewayHandler1.setNextGatewayHandler(gatewayHandler2);
        GatewayHandler gatewayHandler3 = new ConversationHandler();
        gatewayHandler2.setNextGatewayHandler(gatewayHandler3);
        return gatewayHandler1;
    }
}
